<?php
/**
 * Created by PhpStorm.
 * User: Korbin
 * Date: 2018/11/10
 * Time: 11:17
 */

namespace app\script\command;

use app\common\model\Job;
use app\common\model\News;
use app\common\model\NewsContent;
use app\common\model\NewsType;
use think\console\Input;
use think\console\input\Option;
use think\console\Output;

class UcIdn extends Base
{

    private $listKey = 'articles';//获取数据区域
    private $startUrl = 'http://flow.maribacaberita.com/api/v1/channel/';
    private $classNameArr=['Rekomendasi','Video','Bola','Hiburan','Gaya Hidup','Humor','Pilpres2019','Belanja','Mobile Legends','Populer','Teknologi','Unik & Seru','Cantik','Nasional','Internasional','Fun','Moto GP','Otomotif','Olahraga','Ekonomi','Kesehatan','Travel','KPOP','Anime','TV','Sejarah','Inspirasi'];
    private $baseArr=[
        '103?brow_ver=12.9.7.1153&auto=0&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371730366&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=1542371678241&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=a7bbdacd-e391-4998-a90c-9691d92a1c6c&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '3503?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371756262&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=1542368770603&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=29d5fb25-ee18-496f-899b-c91aea064a0d&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '2703?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371775535&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=1542368777626&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=64864025-3252-481a-91ed-b733495e1ce6&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '303?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371787815&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=1542369050161&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=71a6f678-f398-498d-a530-f6d9f2f08b11&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '803?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371815023&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=1542369079067&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=c3fd16bf-cec6-4027-b34c-4008e9ab5949&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '4903?brow_ver=12.9.7.1153&auto=0&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371835126&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=1542371678435&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=2&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=9c353db2-63a3-4c02-9f1b-9ee6c50c27bf&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '3603?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371848809&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '11203?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371860196&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '11303?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371870951&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '203?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371880125&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '1503?brow_ver=12.9.7.1153&auto=1&signature=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542371889695&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '603?brow_ver=12.9.7.1153&auto=0&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372509072&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=1542372491524&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=5&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=f12de719-191c-4e95-a71e-22a1d8293543&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '9603?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372525311&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '2903?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372542253&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '1003?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372553383&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '9703?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372563582&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '2803?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372638688&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '1703?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372649253&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '1203?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372660650&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '2103?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372671289&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '1603?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372686972&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '2403?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372702817&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '5003?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372717033&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '6803?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372734837&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '8203?brow_ver=12.9.7.1153&auto=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372752124&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '6503?brow_ver=12.9.7.1153&auto=1&signature=1&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372773325&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=0&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=1&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch=',
        '7103?brow_ver=12.9.7.1153&auto=0&isp=AANYN84fwdXuDHSfHppe64%2Bc&service_ticket=&bl=HUAWEI&ark_sver=beta&uc_param_str=dnvebifrmintcpwidsudsvnwpflaefmtdich&adid=&ct_lang=indonesian&appname=browser-addin&asdk=26&ma=AAPLje%2F6mi%2BWDDzj7RtGyBkrDQkFmyCf4dV6WRFdQ3xh7w%3D%3D&iflow_login=0&_tm=1542372797279&lang=indonesian&entry2=list&at2=C&at1=A&ucid=&app=browser_iflow&at4=A&ftime=1542372786039&entry1=homepage&at3=A&ver=12.9.7.1153&at6=A&at5=A&method=new&sver=inapppatch3&subscribe_targets=&count=15&reco_times=2&ark_ver=22.9.4.1014&debug_log=&set_lang=indonesian&entry=browser&brow_sver=inapppatch3&recoid=e14c4785-f8fc-4ad6-a237-a110524ae08f&dn=39019956560-6cce295a&ve=12.9.7.1153&bi=355&fr=android&mi=HUAWEI+NXT-AL10&nt=2&pc=AASZtg30J6cEZGl0meB9hj0EzMx%2F3vV1aRhH5XL4N7cQQpFP3tKt3W8yLt7axo331pnfaSbKjmm3BAumA5VYSkX%2F&wf=AAT%2FusDVFBpmDf56fHblX4%2B0&ut=AAQIjSJ0HqLiNlgLgCmA8qTPvsE3Hx7xZtwuus0yPd2Cdg%3D%3D&sv=inapppatch3&nw=WIFI&pf=145&la=id&mt=IZpLL1FLOhqlCjVnHKe0a9I1UhQIHNp2&di=7f1902fc2096c7d3&ch='
    ];
    /**
     * 设置执行名称及配置传入参数、脚本描述
     */
    protected function configure()
    {
        //设置执行名称
        $this->setName('ucidnNews')
            ->addOption('job', 'j', Option::VALUE_OPTIONAL)
            ->setDescription('Run all the time');
    }

    /*********************公用验证部分************************************/
    /*
     * 执行脚本任务
     *
     * @param Input $input
     * @param Output $output
     */
    protected function execute(Input $input, Output $output)
    {
        $job = $input->getOption('job');
        if (empty($job)) {
            $output->writeln('请传入执行任务ID：' . date('Y-m-d H:i:s'));
            exit();
        }

        $output->writeln('脚本开始：' . date('Y-m-d H:i:s'));
        $jobModel = new Job();
        $jobInfo = $jobModel->where(['id' => $job])->find();//获取任务配置信息
        if (empty($jobInfo)) {
            $output->writeln('任务ID不存在：' . date('Y-m-d H:i:s'));
            exit();
        } else {
            $jobInfo = $jobInfo->toArray();
        }
//        $this->redis->hSet('job_status',$job,1);
        $jobRedisInfo = $this->redis->hGet('jobHash', $job);//获取任务redis记录
        if (empty($jobRedisInfo)) {
            $jobRedisData = [
                'planned_quantity' => $jobInfo['planned_quantity'],
                'real_quantity' => (empty($jobInfo['real_quantity']) ? 0 : $jobInfo['real_quantity']),
                'shortvideo_num' => (empty($jobInfo['shortvideo_num']) ? 0 : $jobInfo['shortvideo_num']),
                'smallvideo_num' => (empty($jobInfo['smallvideo_num']) ? 0 : $jobInfo['smallvideo_num']),
                'finsh_time' => '',
            ];
        } else {
            $jobRedisData = json_decode($jobRedisInfo, true);
            $jobRedisData['planned_quantity'] = $jobInfo['planned_quantity'];
        }
        $newsTypeId = [];
        $this->createType($jobInfo,$newsTypeId);
        //开始循环执行采集任务
        while (true) {
            //采集开始执行验证采集开关是否打开
            $jobStatus = $this->redis->hGet('job_status', $job);
            if ($jobStatus != 1) {
                break;//采集开关关闭时跳出循环结束脚本执行
            }

            foreach ($this->classNameArr as $key=>$val) {
                $url=$this->startUrl.$this->baseArr[$key];

                $result = $this->getApiData($url);//获取采集源结果

                //验证是否有相应的采集数据
                if (is_array($result) && array_key_exists($this->listKey, $result)) {
                    $lists = $result[$this->listKey];
                } else {
                    $output->writeln($this->getName() . '采集源服务器出错或找不到采集信息！'. date('Y-m-d H:i:s'));
                    continue;
                }

                //开始拼装数据
                $insertData = [];
                if (!empty($lists)) {
                    $this->createData($lists, $jobInfo, $jobRedisData, $insertData,$newsTypeId[$val]);//对源数据进行对应入库
                    if (!empty($insertData)) {
                        //当实际采集数据大于等于计划采集数据量时设置redis开关值
                        if (($jobRedisData['planned_quantity'] - $jobRedisData['real_quantity']) <= 0) {
                            $this->redis->hSet('job_status', $job, 2);//正常完成值为2
                            $jobRedisData['finsh_time'] = date('Y-m-d H:i:s');//正常完成时间记录
                            $jobModel->save(['job_status'=>2,'status_time'=>date('Y-m-d H:i:s')],['id'=>$job]);
                        }
                        $this->redis->hSet('jobHash', $job, json_encode($jobRedisData));
                        $output->writeln('【' . $this->getName() . '采集成功】本次采集入库数据条数为【' . count($insertData) . '】'. date('Y-m-d H:i:s'));
                    } else {
                        $output->writeln('【' . $this->getName() . '执行成功】本次采集无符合要求的数据入库!'. date('Y-m-d H:i:s'));
                    }
                } else {
                    $output->writeln('【'.$this->getName().'请求成功】本次请求无返回正确数据!'.date('Y-m-d H:i:s'));
                    continue;
                }
            }

            //间隔随机时间
            $sleep = rand(5, 10);
            sleep($sleep);
        }

        $output->writeln($this->getName().'任务执行完毕：' . date('Y-m-d H:i:s'));
    }
    /*********************公用验证部分************************************/

    /**
     * 组装url进行数据获取
     * @param $url
     * @return mixed
     */
    private function getApiData($url)
    {
        $result = curl_get_https($url);

        $result = json_decode($result, true);
        return $result['data'];
    }

    /**
     * 采集数据拼装入库
     *
     * @param $lists
     * @param $jobInfo
     * @param $jobRedisData
     * @param $insertData
     * @param $typeId
     */
    private function createData($lists, $jobInfo, &$jobRedisData, &$insertData,$typeId)
    {
        $news =  new News();
        $newContent=new NewsContent();

        $contentInsertData=[];
        $updateData=[];
        $dataIds = [];
        foreach ($lists as $val) {
            if(!is_array($val) && $val['is_content'] != 1){
                continue;
            }
            $data = [];
            //视频评论、点赞、收藏、分享数
            $data['thumb_num'] = array_key_exists('like_count',$val)?$val['like_count']:0;
            $data['comment_num'] = $val['comment_count'];
            $data['watch_num'] = $val['read_count'];
            $data['share_num'] = $val['share_count'];

            //验证视频是否符合采集需求
            $validateRes = $this->validateNum($data,$jobInfo);
            if ($validateRes == false) {
                continue;
            }
            //平台信息【可不动】
            $data['job_id'] = $jobInfo['id'];
            $data['language'] = $jobInfo['lang'];
            $data['country'] = $jobInfo['country'];
            $data['platform'] = $jobInfo['platform'];
            $data['create_by'] = $jobInfo['create_by'];
            $data['create_date'] = date('Y-m-d H:i:s');
            $data['update_by'] = $jobInfo['update_by'];
            $data['update_date'] = date('Y-m-d H:i:s');
            $data['remarks'] = '';

            //新闻信息
            $data['uni'] = $val['id'];//第三方视频唯一ID
            if(in_array($data['uni'],$dataIds,true)){
                continue;
            }
            array_push($dataIds,$data['uni']);
            $data['title'] = $val['title'];//新闻标题
            $img = [];
            foreach($val['thumbnails'] as $arr){
                array_push($img,$arr['url']);
            }
            $data['cover_img'] = implode(',',$img);//封面
            $data['cover_show_type'] = count($img) == 1 ? 2 : 3;//封面类型

            $data['author_avatar'] = '';//作者头像
            $data['author_name'] = '';//作者姓名
            $data['create_time'] = time();//创建时间
            $data['update_time'] = time();//更新时间
            $data['href']=$val['url'];
            $data['source']=$val['original_url'];
            $data['visit_count'] = $val['read_count'];//访问数量
            $data['type_id'] = $typeId;//访问数量
            $data['like_count'] = $val['like_count'];//点赞数量
            $data['comment_count'] = $val['comment_count'];//留言个数
            $data['unlike_count'] = 0;//
            $data['unlike_enable'] =0;//是否允许不喜欢
            $data['can_comment'] = 1;//是否允许评论,默认为1允许',
            $data['share_count'] = $val['share_count'];//分享个数
            $data['listorder'] = 0;//排序
            $data['status'] = 1;//状态:1显示,2不显示

            //判断是否 已经存在
            $isExist = $news->field('id')->where([
                'uni' => $data['uni']
            ])->find();
            if ($isExist) {
                $data['id'] = $isExist['id'];
                $updateData[] = $data;
            }else{
                $data['id'] = com_create_guid();//生成唯一UUID

                $dataContent = [];
                $dataContent['id'] = com_create_guid();//生成唯一UUID
                $content = $val['content'];
                preg_match_all('/<res-image id="(.*)"><\/res-image>/U',$content,$res);
                foreach($res[1] as $resKey=>$value){
                    $imgHtml = '';
                    foreach($val['images'] as $imgArr){
                        if($imgArr['id'] == $value){
                            $imgHtml = '<img src="'.$imgArr['url'].'" />';
                        }
                    }
                    $content = str_replace($res[0][$resKey],$imgHtml,$content);
                }
                $dataContent['content']=$content;
                $dataContent['update_time']=time();
                $dataContent['create_by']=$data['create_by'];
                $dataContent['create_date']=date('Y-m-d H:i:s');
                $dataContent['update_by']=$data['update_by'];
                $dataContent['news_id']=$data['id'];
                $dataContent['remarks']='';
                $contentInsertData[]=$dataContent;
                $jobRedisData['real_quantity'] += 1;//实际采集数量+1
                $insertData[] = $data;
            }
        }
        $news->allowField(true)->isUpdate(true)->saveAll($updateData);
        $news->allowField(true)->isUpdate(false)->saveAll($insertData,false);
        $newContent->allowField(true)->isUpdate(false)->saveAll($contentInsertData, false);
        $insertData = array_merge($insertData,$updateData);
    }

    /**
     * 验证采集数据是否符合条件
     *
     * @param $data
     * @param $jobInfo
     * @return bool
     */
    private function validateNum($data,$jobInfo){
        $res = true;
        $keys = array_keys($data);
        foreach ($keys as $val){
            if($jobInfo[$val]>$data[$val]){
                $res = false;
                break;
            }
        }
        return $res;
    }

    /**
     * 创建平台类型
     *
     * @param $jobInfo
     * @param $newsTypeId
     */
    private function createType($jobInfo,&$newsTypeId){
        $newType=new NewsType();
        $newsTypeId = [];
        $newsTypeId = $newType->where(['platform'=>$jobInfo['platform']])->column('name,id');
        if(empty($newsTypeId)){
            $insertData=[];
            foreach($this->classNameArr as $val){
                $data['id']=com_create_guid();//生成唯一UUID
                $data['name']=$val;
                $data['platform']=$jobInfo['platform'];
                $data['type']=2;
                $data['status']=1;
                $data['create_time']=time();
                $data['sort']=0;
                $data['is_hot']=1;
                $data['create_by']=$jobInfo['create_by'];
                $data['create_date']=$jobInfo['create_date'];
                $data['update_by']=$jobInfo['update_by'];
                $data['update_date']=$jobInfo['update_date'];
                $insertData[]=$data;
                $newsTypeId[$data['name']] = $data['id'];
            }
            $newType->allowField(true)->insertAll($insertData);
        }
    }

}